#pragma once;

#include "common.h"

#include "contact.h"

namespace TorPhysix
{
	struct CollisionData
	{
	public:
		// TODO: use std::vector
		Contact *contactArray; // points to the first contact in contacts below
		Contact *contacts; // contact array
		unsigned int contactsLeft; // number of contacts the array can take

		real restitution;
		real friction;
		real tolerance; // non-colliding objects this close should have collisions generated, a fudge factor
		unsigned contactCount; // number contacts found so far
		

		bool hasMoreContacts()
		{
			return contactsLeft > 0;
		}

		void reset(unsigned maxContacts)
		{
			contactsLeft = maxContacts;
			contactCount = 0;
			contacts = contactArray;
		}

		void addContacts(unsigned count)
		{
			// Reduce the number of contacts remaining, add number used
			contactsLeft -= count;
			contactCount += count;

			// Move the array forward
			contacts += count;
		}
	};

}